import Vue from "vue";
import Vuex from "vuex";
import persistence from "vuex-uniapp-persistence";
import user from "./user";
import address from "./address";

Vue.use(Vuex);
const store = new Vuex.Store({
  plugins: [persistence()],
  state: {
    // 导航栏的安全区域
    safeArea: uni.getWindowInfo().safeArea,
    // 胶囊的安全区域
    capsule: uni.getMenuButtonBoundingClientRect(),
    // 获取设备平台 - getSystemInfoSync 同步获取，不建议使用 getSystemInfo 异步获取
    platform: uni.getSystemInfoSync().platform,
  },
  getters: {},
  mutations: {},
  modules: {
    user,
    address,
  },
});
export default store;
